package com.heima.admin.controller;
import com.heima.admin.operationEnum.HttpRequestMethod;
import com.heima.api.INewsClient;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.dtos.WmChannelDto;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/channel")
@Slf4j
public class AdChannelController {
    @Autowired
    INewsClient iNewsClient;
    /**
     * 频道名称模糊分页查询
     * @return
     */
    @PostMapping("/list")
    public ResponseResult pageChannel(@RequestBody WmChannelDto wmChannelDto){
        return iNewsClient.pageChannel(wmChannelDto);
    }
    /**
     * 删除频道
     */
    @GetMapping("/del/{id}")
    public ResponseResult delChannel(@PathVariable Integer id){
       return iNewsClient.delChannel(id);
    }
    /**
     * 修改频道
     */

    @PostMapping("/update")
    public ResponseResult updateChannel(@RequestBody WmChannelDto wmChannelDto){
        return iNewsClient.updateChannel(wmChannelDto);
    }
    /**
     * 新增频道
     */

    @PostMapping("/save")
    public ResponseResult saveChannel(@RequestBody WmChannelDto wmChannelDto){
        return iNewsClient.saveChannel(wmChannelDto);
    }
}
